package com.ctg.itrdc.sysmgr.portal.service.impl;

import com.ctg.itrdc.pasp.context.service.BaseService;
import com.ctg.itrdc.pasp.core.PageInfo;
import com.ctg.itrdc.sysmgr.portal.api.dto.SystemPasswordRuleDTO;
import com.ctg.itrdc.sysmgr.portal.api.service.ISystemPasswordRuleService;
import com.ctg.itrdc.sysmgr.portal.data.ISystemPasswordRuleDao;
import com.ctg.itrdc.sysmgr.portal.data.entity.SystemPasswordRule;
import org.springframework.stereotype.Service;

/**
 * Created by xiongkw on 2017/5/4.
 */
@Service("systemPasswordRuleService")
public class SystemPasswordRuleServiceImpl extends BaseService<SystemPasswordRule, Long, SystemPasswordRuleDTO> implements ISystemPasswordRuleService {

    @Override
    public ISystemPasswordRuleDao getDao() {
        return (ISystemPasswordRuleDao) super.getDao();
    }

    @Override
    public PageInfo<SystemPasswordRuleDTO> queryByName(String search, int currentPage, int perPage) {
        SystemPasswordRule entity = new SystemPasswordRule();
        entity.setName(search);
        PageInfo<SystemPasswordRule> page = getDao().pageBySqlId("queryByName", currentPage, perPage, entity);
        return dtoMapper.mapPageInfo(page, SystemPasswordRuleDTO.class);
    }

}
